import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';

@Entity('tables')
export class Seat {
  @PrimaryGeneratedColumn({ type: 'bigint', comment: '餐桌ID' })
  id: number;

  @Column({ type: 'varchar', length: 20, unique: true, comment: '餐桌编号' })
  tableNumber: string;

  @Column({ type: 'bigint', nullable: true, comment: '区域ID' })
  areaId: number;

  @Column({ type: 'int', default: 2, comment: '座位数' })
  seats: number;

  @Column({ 
    type: 'tinyint',
    default: 0,
    comment: '餐桌状态(0:空闲 1:已预订 2:就餐中 3:待清理)'
  })
  status: number;

  @Column({ type: 'varchar', length: 255, nullable: true, comment: '餐桌二维码' })
  qrCode: string;

  @Column({ type: 'bigint', nullable: true, comment: '当前订单ID' })
  currentOrderId: number;

  @Column({ 
    type: 'boolean',
    default: true,
    name: 'is_active',
    comment: '是否启用(1:启用 0:停用)'
  })
  isActive: boolean;

  @Column({ type: 'varchar', length: 255, nullable: true, comment: '餐桌描述' })
  description: string;

  @Column({ 
    type: 'decimal',
    precision: 10,
    scale: 2,
    default: 0,
    name: 'min_consumption',
    comment: '最低消费'
  })
  minConsumption: number;

  @CreateDateColumn({ 
    type: 'datetime',
    name: 'created_at',
    comment: '创建时间'
  })
  createdAt: Date;

  @UpdateDateColumn({
    type: 'datetime',
    name: 'updated_at',
    comment: '更新时间'
  })
  updatedAt: Date;
}
